package jmine.tec.web.wicket.component.menu.cfg;

import java.util.List;

/**
 * FactoryBean de MenuConfig que faz merge de múltiplos menus.
 * 
 * @author lundberg
 */
public class MenuConfigMergerFactoryBean extends AbstractMenuConfigFactoryBean {

    private List<MenuConfig> configs;

    /**
     * Construtor
     * 
     * @param configs configs
     */
    public MenuConfigMergerFactoryBean(List<MenuConfig> configs) {
        super();
        this.configs = configs;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected MenuConfig createMenuConfig() {
        MenuConfig merged = null;
        for (MenuConfig config : this.configs) {
            merged = config.merge(merged);
        }
        return merged;
    }
}
